import { drawGrid } from "./modules/grid";
import { drawAxis } from "./modules/axis";
import { turnOnBrush } from "./modules/brush";
class BaseTool {
  constructor(context) {
    this.context = context;
  }
  static init(ele) {
    let canvas = document.createElement("canvas");
    canvas.width = ele.offsetWidth;
    canvas.height = ele.offsetHeight;
    ele.appendChild(canvas);
    return new BaseTool(canvas.getContext("2d"));
  }
  drawGrid() {
    drawGrid(this.context, ...arguments);
  }
  drawAxis() {
    drawAxis(this.context, ...arguments);
  }
  turnOnBrush() {
    turnOnBrush(this.context, ...arguments);
  }
  clear() {
    this.context.clearRect(
      0,
      0,
      this.context.canvas.width,
      this.context.canvas.height
    );
  }
}

export default BaseTool;
